'''
Created on Nov 19, 2010

@author: namikata
'''

from gameobjects.vector2 import Vector2
from game.base.GameEntity import GameEntity, KMOV_NONE

class Cursor(GameEntity):
    '''
    classdocs
    '''

    def __init__(self,world,name,image,objclass, objsclass, location):
        '''
        Constructor
        '''
        GameEntity.__init__(self, world, name, image, objclass, objsclass)
        
        #actual position
        self.sprite.set_position(location.x, location.y)
        #max speed
        self.speed = 0.
        #movement type
        self.movement_type = KMOV_NONE
        
    def update(self,elapsed, keyboard, mouse):
        mouse.location.x = max(self.world.bounds[0].x,mouse.location.x)
        mouse.location.x = min(self.world.bounds[1].x,mouse.location.x)
        mouse.location.y = max(self.world.bounds[0].y,mouse.location.y)
        mouse.location.y = min(self.world.bounds[1].y,mouse.location.y)
        
        self.sprite.set_position(mouse.location.x, mouse.location.y)
                
        GameEntity.update(self, elapsed)